How can I execute "strings" as an actual command

I have defined a series of filters (filter1, filter2, filter3...)
I need to run each of these filters in turn.
Is it actually possible to create a string array with the items:

{"set filter1", "set filter2", "set filter3}

be able execute these array items as a command?

If not, do you know of another solution to my problem?

Thanks in advance
monde888 - Mon May 10 07:47:55 EDT 2010

Re: How can I execute "strings" as an actual command
Mathias Mamsch - Tue May 11 12:49:31 EDT 2010

Actually from your post it is not so clear to me what exactly your problem is, setting a filter from an array or converting a string to a filter.
If you want to have an array of filters you could do:
 

Filter arFilts[] = {attribute "Absolute Number" == "123", 
                    attribute "Absolute Number" == "456",
                    attribute "Absolute Number" == "789"}
 
 
for i in 0:2 do { set arFilts[i]; filtering on }

 


Turning a string into a filter can be more difficult (depending on your strings). There is no built in function for that - so in the easiest case your strings contain just an attribute value like

 

 

string ar[] = {"Val 1", "Val 2", "Val 3" }



in this case you can just do set(attribute "MyAttribute" == ar[i]) but if your strings are very complex like ("attr1 != 3 && attr2 contains 4") you would probably do your own parsing. I guess this problem has been adressed in this forum, so you might be lucky to find a solution for this.

Regards, Mathias



 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS